<template>
	<div class="header">
		 <div class="content-wrapper">
	      <div class="avatar">
	        <img width="80" height="80" :src="seller.avatar">
	      </div>
	      <div class="content">
	        <div class="title">
	          <span class="name">{{seller.mchtName}}</span>
	        </div>
	        <div class="description">
	          		<!--欢迎光临！温暖你的是服务，感动你的是美食！-->
	          		{{seller.mchtRname}}
	        </div>
	      </div>
	    </div>
	    <div class="desk">
				<ul class="desk_msg">
					<li class="meat_num" style="border-right: 1px solid #cccccc;">
						用餐人数
						<div class="paddingbox">
							<div class="meat_Company full-right">
								人
							</div>
							<input type="number" @keyup="keyup" @afterupdate="afterupdate" @blur="blur" class="eatnum full-right" v-model="value" />		
						</div>
					</li>
					<li class="desk_num">
						餐桌编号
						<div class="paddingbox">
							<div class="meat_Company full-right">
								号
							</div>
							<div class="eatnum full-right">{{this.table}}</div>	
						</div>							
					</li>
				</ul>
 		</div>
	</div>
</template>

<script type="text/ecmascript-6">
  import star from 'components/star/star';

  export default {
    props: {
      seller: {
        type: Object
      }
    },
    data() {
      return {
        detailShow: false,
        table:"",
        value:1
      };
    },
    methods: {
      showDetail() {
        this.detailShow = true;
      },
      hideDetail() {
        this.detailShow = false;
      },
      keyup(){
      	if(this.value.length==1)
      	{
      		this.value=this.value.replace(/[^1-9]/g,'')
      	}
      	else
      	{
      		this.value=this.value.replace(/\D/g,'')
      	}
      	
      },
      afterupdate(){
      	if(this.value.length==1)
      	{
      		this.value=this.value.replace(/[^1-9]/g,'')
      	}
      	else
  		{
  			this.value=this.value.replace(/\D/g,'')
  		}
      },
      blur(){
      	if(!sessionStorage.getItem("personNumber")){
    		sessionStorage.setItem("personNumber",this.value);
    	}else{
    		sessionStorage.removeItem("personNumber");
    		sessionStorage.setItem("personNumber",this.value);
    	};
      }
    },
    created() {
      this.table =JSON.parse(sessionStorage.getItem("table"));
      sessionStorage.setItem("personNumber",this.value);
    },
    components: {
      star
    }
  };
</script>

<style lang="stylus" rel="stylesheet/stylus">
	.description{
		height: 28px;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
	}
</style>